/*
 * Created on Apr 3, 2006
 *
 */
package ar.edu.utn.frba.gdaia.src.junittest;

import java.util.HashMap;
import java.util.Map;

import junit.framework.TestCase;
import ar.edu.utn.frba.gdaia.src.action.Command;
import ar.edu.utn.frba.gdaia.src.action.MakePresentSituationCommand;
import ar.edu.utn.frba.gdaia.src.domain.Canal;
import ar.edu.utn.frba.gdaia.src.domain.Situacion;
import ar.edu.utn.frba.gdaia.src.main.Cerebro;
import ar.edu.utn.frba.gdaia.src.main.GDAIA;

/**
 * @author Patricio, Juan, Fernando
 */

public class MakePresentSituationTest extends TestCase {

	public static void main(String[] args) {
		junit.swingui.TestRunner.run(MakePresentSituationTest.class);
	}

	Cerebro cerebro = null;

	GDAIA gdaia = new GDAIA();

	Map parameters = null;

	/*
	 * @see TestCase#setUp()
	 */
	protected void setUp() throws Exception {
		super.setUp();
		// genero el cerebro a partir del XML
		cerebro = gdaia.generateCerebroFromXML();
		parameters = new HashMap();
		parameters.put(Command.CEREBRO, cerebro);
	}

	/*
	 * @see TestCase#tearDown()
	 */
	protected void tearDown() throws Exception {
		super.tearDown();
		gdaia.generateXMLForCerebro(cerebro);
	}

	/**
	 * Constructor for MakePresentSituationTest.
	 * 
	 * @param arg0
	 */
	public MakePresentSituationTest(String arg0) {
		super(arg0);
	}

	public final void testExecute() {
		Situacion situacionCreada = new Situacion(cerebro
				.getListaUltimosConceptosLeidos(), Canal.INT_MAKE_PRESENT_SIT);
		new MakePresentSituationCommand().execute(parameters);
		assertTrue(cerebro.getSituacionActual().equals(situacionCreada));
	}

}
